// JavaScript Document
function ThemNT()
{
	HoTen=$("input[name=txtHoTen]").val();
	Nickname=$("input[name=txtNickname]").val();
	Hinh=$("img[name=imgHinh]").attr("src");
	if($("input[name=radGioiTinh]").val()=="radNam")
		GioiTinh="True";
	else
		GioiTinh="False";
	NgaySinh=$("input[name=dateNgaySinh]").val();
	NoiSinh=$("input[name=txtNoiSinh]").val();
	QueQuan=$("input[name=txtQueQuan]").val();
	DanToc=$("input[name=txtDanToc]").val();
	TonGiao=$("input[name=txtTonGiao]").val();
	CMND=$("input[name=txtCMND]").val();
	NoiThuongTru=$("input[name=txtNoiThuongTru]").val();
	NoiOHienNay=$("input[name=txtNoiOHienNay]").val();
	TrinhDo=$("input[name=txtTrinhDo]").val();
	TrinhDoChuyenMon=$("input[name=txtTrinhDoChuyenMon]").val();
	NgoaiNgu=$("input[name=txtNgoaiNgu]").val();
	NgheNghiep=$("input[name=txtNgheNghiep]").val();
	Tu14t=$("input[name=txtTu14t]").val();
	NgayVao=$("input[name=dateNgayVao]").val();
	MaP=$("select[name=cmbPhong]").val();
	if($.trim(HoTen)=="")
	{
		alert("Chưa nhập Họ Tên");
		return;	
	}
	else
	{
		url="ajax.php?action=ThemNT&HoTen="+HoTen+"&Nickname="+Nickname+"&Hinh="+Hinh+"&GioiTinh="+GioiTinh;
		url+="&NgaySinh="+NgaySinh+"&NoiSinh="+NoiSinh+"&QueQuan="+QueQuan+"&DanToc="+DanToc+"&TonGiao="+TonGiao;
		url+="&CMND="+CMND+"&NoiThuongTru="+NoiThuongTru+"&NoiOHienNay="+NoiOHienNay+"&TrinhDo="+TrinhDo+"&TrinhDoChuyenMon="+TrinhDoChuyenMon;
		url+="&NgoaiNgu="+NgoaiNgu+"&NgheNghiep="+NgheNghiep+"&Tu14t="+Tu14t+"&NgayVao="+NgayVao+"&MaP="+MaP;
		$.get(url,function(data) 
		{
			alert("Thêm Thành Công");
			location.href='QLNguoiThue.php';
		});	
	}
}

function ChiTietNT(MaNT)
{
	$("input[name=txtHoTen]").val($("tr[id="+MaNT+"] td[class=HoTen]").html());
	$("input[name=txtHoTenKhac]").val($("tr[id="+MaNT+"] td[class=HoTenKhac]").html());
	//$("input[name=Hinh]").val($("tr[id="+MaNT+"] td[class=Hinh]").html());
	//$("input[name=GioiTinh]").val($("tr[id="+MaNT+"] td[class=HoTen]").html());
	$("input[name=txtNgaySinh]").val($("tr[id="+MaNT+"] td[class=NgaySinh]").html());
	$("input[name=txtNoiSinh]").val($("tr[id="+MaNT+"] td[class=NoiSinh]").html());
	$("input[name=txtQueQuan]").val($("tr[id="+MaNT+"] td[class=QueQuan]").html());
	$("input[name=txtDanToc]").val($("tr[id="+MaNT+"] td[class=DanToc]").html());
	$("input[name=txtTonGiao]").val($("tr[id="+MaNT+"] td[class=TonGiao]").html());
	$("input[name=txtCMND]").val($("tr[id="+MaNT+"] td[class=CMND]").html());
	$("input[name=txtNoiThuongTru]").val($("tr[id="+MaNT+"] td[class=NoiThuongTru]").html());
	$("input[name=txtNoiOHienNay]").val($("tr[id="+MaNT+"] td[class=NoiOHienNay]").html());
	$("input[name=txtTrinhDo]").val($("tr[id="+MaNT+"] td[class=TrinhDo]").html());
	$("input[name=txtTrinhDoChuyenMon]").val($("tr[id="+MaNT+"] td[class=TrinhDoChuyenMon]").html());
	$("input[name=txtTiengDanToc]").val($("tr[id="+MaNT+"] td[class=TiengDanToc]").html());
	$("input[name=txtNgoaiNgu]").val($("tr[id="+MaNT+"] td[class=NgoaiNgu]").html());
	$("input[name=txtNgheNghiep]").val($("tr[id="+MaNT+"] td[class=NgheNghiep]").html());
	//$("input[name=Tu14t]").val($("tr[id="+MaNT+"] td[class=HoTen]").html());
	//$("input[name=DangThue]").val($("tr[id="+MaNT+"] td[class=HoTen]").html());
	$("input[name=txtNgayVao]").val($("tr[id="+MaNT+"] td[class=NgayVao]").html());
	$("input[name=txtNgayDi]").val($("tr[id="+MaNT+"] td[class=NgayDi]").html());
}